// pages/my/mainpage/mainpage.js
const app =getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    names:"WELCOME",
    hearIcon:"../../imgs/wo@2x.png",
    vip:"你还不是会员，请登录",
    toLogin:"去登录"
  },
  setUser:function(){
    if (!app.globalData.userObj){
      return;
    }
    var obj = app.globalData.userObj;
    var rawData = JSON.parse(obj.rawData);
    this.setData({
      names: rawData.nickName,
      hearIcon: rawData.avatarUrl
    })
  },
  toPro:function(){
    wx.navigateTo({
      url: '../problem/problem',
    })
  },
  toReturn:function(){
    wx.navigateTo({
      url: '../returns/returns',
    })
  },
  toLogin:function(){
    wx.navigateTo({
      url: '../signin/signin',
    })
  },
  toAddress:function(){
    wx.navigateTo({
      url: '../address/address',
    })
  },
  toProposal:function(){
    wx.navigateTo({
      url: '../proposal/proposal',
    })
  },
  toSetup:function(){
    wx.navigateTo({
      url: '../setup/setup',
    })
  },
  toService:function(){
    wx.navigateTo({
      url: '../service/service',
    })
  },
  toLease:function(){
    wx.navigateTo({
      url: '../lease/lease',
    })
  },
  toOrder:function(){
    wx.navigateTo({
      url: '../buyorder/buyorder',
    })
  },
  toSub:function(){
    wx.navigateTo({
      url: '../substitute/substitute',
    })
  },
  toDeposit:function(){
    wx.navigateTo({
      url: '../deposit/deposit',
    })
  },
  toCoupon:function(){
    wx.navigateTo({
      url: '../coupon/coupon',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setUser();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})